{include file='comdir/head.html'}
<body>
 <form id="frm" action="javascript:void(0)">
    <div class="login_wrap violet2">
        <div class="admin_login2">
            <h1><b>后台管理系统</b></h1>
            <dl>
                <dd>
                    <input type="text" name="loginname" placeholder="用户名" class="inptext loginnmae">
                </dd>
                <dd>
                    <input type="password" name="password" placeholder="密码" class="inptext pass">
                </dd>
                {if $admin_yzm==1}
                <dd>
                    <input type="text" placeholder="验证码" name="yzm" class="inptext yzm">
                    <div class="yzm_btn" onclick="changeImg()"><img id="Imageid" src="{$_URL}Login/verify"></div>
                </dd>
                {/if}
            </dl>
            <div class="submit-box">
                <input type="submit" value="LOGIN" class="submit login_sub">
            </div>
        </div>
    </div>
</form>
<script>
var _URL='{$_URL}';
{literal}
    function changeImg(){
		document.getElementById("Imageid").src = _URL+"Login/verify?id="+new Date();
    }
	var ajax_status=true;
	$(function(){
		$('.login_sub').click(function(){
			from_submit();
		})
	})
	 document.onkeydown=function(event){
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==13){ // enter 键
            from_submit();
        }
    };
    function from_submit(){
		var url=_URL+"Login/login_ajax";
		var formjquery=_ajaxs.from('#frm');
		//验证
		var loginname=$('.loginnmae').val();
		if(loginname.length<5 || loginname>17 ||!_check.isnozh(loginname)){
			layer.msg('账号长度为6-15个英文与数字组成的字符',{icon: 5}, function(){});
			return false;
		}
		var password=$('.pass').val();
		if(password.length<6 || !_check.isnozh(password)){
			layer.msg('账号长度为6-密码长度不能小于6个英文与数字组成的字符',{icon: 5}, function(){});
			return false;
		}
		
		if(!ajax_status){//防止恶意提交
			return false;
		}
		ajax_status=false;
		//验证结束
		_ajaxs.post(url,'formjquery='+formjquery,function _result(data){
			ajax_status=true;
			layer.msg(data.msg,{icon: 6}, function(){
				if(data.status){
					window.location.href=_URL+"Index/index";
				}
			});
		});
    }
{/literal}
</script>
</body>
</html>
